package com.hd.quartz.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * <h3>partitionjob</h3>
 * <p>HttpContextUtils</p>
 *
 * @author : hduong
 * @version : 1.0
 * @date : 2020-09-15 15:37
 **/
public class HttpContextUtils {

    /**
     * ServletRequestAttributes 校验了 Request must not null
     * @return
     */
    public static HttpServletRequest getHttpServletRequest() {
        return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
    }
}
